package cn.gson.crm.controller.delete;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.EmploDao;
import cn.gson.crm.model.entity.Employee;

/**
 * 显示离职的员工
 */
@WebServlet("/show/delete/emp")
public class ShowDeleteEmp extends BaseServlet {
	private static final long serialVersionUID = 1L;
    private EmploDao empDao = new EmploDao();   
	
    @Override
    protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	super.get(request, response);
    	String p = request.getParameter("page");
    	String userName = request.getParameter("userName");
    	if(p==null || p.isEmpty()){
    		p = "1";
    	}
    	
    	Integer page = Integer.parseInt(p);
    	
    	List<Employee> empList = empDao.getPageEmploByStatus("删除", page, userName);
    	
    	int totalPage = empDao.getTotalPage("删除", userName);
    	request.setAttribute("totalPage", totalPage);
    	request.setAttribute("empList", empList);
    	request.setAttribute("page", page);
    	getServletPathAndForward(request, "delete/delete_emp.jsp");
    }

}
